home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / faketo4d.zip / FAKETO4D.PAS < prev    next >
Pascal/Delphi Source File  |  1991-10-05  |  3KB  |  116 lines

  1. {$V-}
  2. program FakeTo4D;
  3.  
  4. uses dos,crt,totmisc,totstr,heapunt2;
  5.  
  6. const VER ='FakeTo4D v1.0';
  7.  
  8. var
  9.     Net,Node,PointNet,
  10.     i: integer;
  11.     DirInfo: SearchRec;
  12.  
  13.     Outbound,
  14.     srch,
  15.     num,
  16.     temp1,temp2,
  17.     temp3: string;
  18.  
  19.     delfile: file;
  20.     infile,outfile: text;
  21.  
  22.     file_list: HeapObj;
  23.  
  24. {==========================================================================}
  25. { This Procedure Gives MySelf some well derserved credit @ the DOS prompt. }
  26. {==========================================================================}
  27. procedure Display_Logo;
  28.  
  29. begin  {** Procedure Display_Logo **}
  30.   textcolor(7); textbackground(0);
  31.   Writeln(VER+' by Ron Pritchett of 1:376/74.0');
  32.   Writeln('Copyright (c) 1991 Realm Software, Distribute Freely, No Modifications');
  33.   Writeln;
  34. end;  {** Procedure Display_Logo **}
  35.  
  36.  
  37. begin
  38.   writeln;
  39.   Display_logo;
  40.  
  41.   assign(infile,'FakeTo4D.ctl');
  42.   reset(infile);
  43.  
  44.   readln(infile,net);
  45.   readln(infile,node);
  46.   readln(infile,pointnet);
  47.   readln(infile,outbound);
  48.  
  49.   writeln('Net/Node: ',net,'/',node);
  50.   writeln('PointNet: ',pointnet);
  51.   writeln('Outbound: ',outbound);
  52.  
  53.   i:=pointnet;
  54.   srch:=outbound+'\'+IntToHexStr(i)+'*.?lo';
  55.  
  56.   FindFirst(srch,archive,DirInfo);
  57.   while DosError = 0 do
  58.     begin
  59.       num:=copy(DirInfo.name,5,4);
  60.       temp1:=Outbound+'\'+PadRight(IntToHexStr(net),4,'0');
  61.       temp1:=temp1+PadRight(IntToHexStr(node),4,'0')+'.PNT\0000';
  62.       temp1:=temp1+num+'.'+copy(DirInfo.name,10,3);
  63.  
  64.       if not exist(temp1) then
  65.         begin
  66.           i:=HexStrToLong(copy(dirinfo.name,5,4));
  67.           write('Moving mail for ',pointnet,'/',i);
  68.           writeln(' to ',net,'/',node,'.',i);
  69.           temp3:=outbound+'\'+dirinfo.name;
  70.           assign(delfile,temp3);
  71.           rename(delfile,temp1);
  72.         end
  73.       else
  74.         begin
  75.           i:=HexStrToLong(copy(dirinfo.name,5,4));
  76.           write('Merging mail for ',pointnet,'/',i);
  77.           writeln(' & ',net,'/',node,'.',i);
  78.           assign(infile,temp1);
  79.           reset(infile);
  80.           file_list.init;
  81.           while not eof(infile) do
  82.             begin
  83.               readln(infile,temp3);
  84.               temp3:=strip('B',#10,temp3);
  85.               file_list.insert(temp3);
  86.             end;
  87.           close(infile);
  88.          erase(infile);
  89.  
  90.           temp2:=outbound+'\'+Dirinfo.name;
  91.           assign(infile,temp2);
  92.           reset(infile);
  93.           while not eof(infile) do
  94.             begin
  95.               readln(infile,temp3);
  96.               temp3:=strip('B',#10,temp3);
  97.               if not file_list.search(temp3) then
  98.                 file_list.insert(temp3);
  99.             end;
  100.           close(infile);
  101.           erase(infile);
  102.  
  103.           assign(outfile,temp1);
  104.           rewrite(outfile);
  105.  
  106.           while not file_list.empty do
  107.             begin
  108.               temp2:=file_list.getmin;
  109.               writeln(outfile,temp2);
  110.             end;
  111.           close(outfile);
  112.         end;
  113.  
  114.       FindNext(DirInfo);
  115.     end;
  116. end.